Skip to content

Conversation

@JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Jul 2, 2025

Our policy wasn't clear from just reading the code.

Our policy wasn't clear from just reading the code.
Comment on lines +22 to +23
This makes it possible to use isinstance(x, <concrete Value
subclass>) checks without worrying about potential subclasses.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be a good idea to mark the concrete classes as @final to document/enforce this?

On a somewhat related noted, can/does mypyc optimize isinstance checks with final types?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that, added @final to the concrete classes. By default @final doesn't help with optimizations, since mypyc can perform whole-program analysis. However, @final would help with isinstance checks if doing separate compilation (but this is currently poorly supported).

@brianschubert brianschubert added the topic-mypyc mypyc bugs label Jul 2, 2025
@JukkaL JukkaL merged commit 1bf186c into master Jul 3, 2025
13 checks passed
@JukkaL JukkaL deleted the mypyc-doc-inheritance branch July 3, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-mypyc mypyc bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants